/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.raitcon.hibernate.backbean;

import static com.raitcon.hibernate.backbean.SeccionBean.log;
import com.raitcon.hibernate.bean.Empleado;
import com.raitcon.hibernate.bean.Seccion;
import com.raitcon.hibernate.db.EmpleadoDB;
import com.raitcon.hibernate.db.SeccionDB;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.model.SelectItem;
import org.apache.log4j.Logger;

/**
 *
 * @author Mike
 */
@ManagedBean(name="empleadoBean")
@RequestScoped
public class EmpleadoBean implements Serializable {
    
    protected static Logger log = Logger.getLogger(CicloBean.class); 
   private static  final  long serialVersionUID=-2377612760546575078L;
   private String currentItem = "";
   private List<SelectItem> empleadoList = new ArrayList<SelectItem>();
   private String selectedEmpleado = "0";
   
   
   
   
   
   
   @PostConstruct
   protected void init(){
       log.debug("init...empleadoBean");
       EmpleadoDB empleadoDB=new EmpleadoDB();
        List<Empleado> empleadoLst=empleadoDB.getEmployeeByType("P");
        SelectItem item = new SelectItem("0", "--Selecciona Profesor--");
         getEmpleadoList().add(item);
        for(Empleado g:empleadoLst){
            item = new SelectItem(g.getIdEmpleado(), g.getNombres()+", "+g.getApellidoPaterno());
            getEmpleadoList().add(item);
        }
      
   }

    /**
     * @return the currentItem
     */
    public String getCurrentItem() {
        return currentItem;
    }

    /**
     * @param currentItem the currentItem to set
     */
    public void setCurrentItem(String currentItem) {
        this.currentItem = currentItem;
    }

    /**
     * @return the empleadoList
     */
    public List<SelectItem> getEmpleadoList() {
        return empleadoList;
    }

    /**
     * @param empleadoList the empleadoList to set
     */
    public void setEmpleadoList(List<SelectItem> empleadoList) {
        this.empleadoList = empleadoList;
    }

    /**
     * @return the selectedEmpleado
     */
    public String getSelectedEmpleado() {
        return selectedEmpleado;
    }

    /**
     * @param selectedEmpleado the selectedEmpleado to set
     */
    public void setSelectedEmpleado(String selectedEmpleado) {
        this.selectedEmpleado = selectedEmpleado;
    }
    
}
